Skip to content

Instantly share code, notes, and snippets.

@xiCO2k
xiCO2k / AuthTest.php
Created October 14, 2022 12:41
Testing Socialite
<?php
it('redirects to the correct Google sign in url', function () {
$driver = Mockery::mock('Laravel\Socialite\Two\GoogleProvider');
$driver->shouldReceive('redirect')
->andReturn(new RedirectResponse('https://redirect.url'));
Socialite::shouldReceive('driver')->andReturn($driver);
$this->get(route('oauth.redirect', 'google'))
@doorgan
doorgan / operations_test.exs
Last active May 11, 2024 22:44
Testing module macros
defmodule OperationsTest do
use ExUnit.Case, async: true
def make_mod() do
String.to_atom("Elixir.Test#{System.unique_integer([:positive])}")
end
describe "operation/2" do
setup do
mod = make_mod()
@Lucrecious
Lucrecious / scale2x.gdshader
Created July 19, 2022 23:51
A Fast Rot-Sprite shader based on Scale3x
shader_type canvas_item;
const vec4 background = vec4(1., 1., 1., 0.);
float dist(vec4 c1, vec4 c2) {
return (c1 == c2) ? 0.0 : abs(c1.r - c2.r) + abs(c1.g - c2.g) + abs(c1.b - c2.b);
}
bool similar(vec4 c1, vec4 c2, vec4 input) {
return (c1 == c2 || (dist(c1, c2) <= dist(input, c2) && dist(c1, c2) <= dist(input, c1)));
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Francophonie\Eudic\Customer Info]
"SerialCode"="cracked by Archon"
"TimesLeft3"=dword:000c85e7
"regDate"="2024/1/1 00:00:00"
"LicenseCode"="cracked by Archon"
@dtr2300
dtr2300 / nvim-events.md
Last active May 11, 2024 22:34
Overview of Nvim Events

Nvim Events

Nvim recognizes the following events. Names are case-insensitive.

BufAdd
Just after creating a new buffer which is
added to the buffer list, or adding a buffer
@codequokka
codequokka / start-tmux-automatically-on-zsh.zsh
Last active May 11, 2024 22:32
Start tmux automatically on zsh
# Start the tmux session if not alraedy in the tmux session
if [[ ! -n $TMUX ]]; then
# Get the session IDs
session_ids="$(tmux list-sessions)"
# Create new session if no sessions exist
if [[ -z "$session_ids" ]]; then
tmux new-session
fi
@zulhfreelancer
zulhfreelancer / install-docker.md
Last active May 11, 2024 22:28
Install Docker oneliner script

Just install Docker

$ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

Install Docker and Rancher Server

$ curl -fsSL get.docker.com -o get-docker.sh &amp;&amp; sh get-docker.sh &amp;&amp; sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server

@rumansaleem
rumansaleem / clean-up-arch-linux.md
Created May 28, 2019 08:51
Instructions to clean up Arch Linux (Manjaro)

Contents

  • Clean pkg cache
  • Remove unused packages (orphans)
  • Clean cache in /home
  • remove old config files
  • Find and Remove
    • duplicates
    • empty files
    • empty directories
  • broken symlinks
@mp4096
mp4096 / ppt2pdf.ps1
Created April 28, 2016 10:56
Batch convert PowerPoint files to PDF
# Batch convert all .ppt/.pptx files encountered in folder and all its subfolders
# The produced PDF files are stored in the invocation folder
#
# Adapted from http://stackoverflow.com/questions/16534292/basic-powershell-batch-convert-word-docx-to-pdf
# Thanks to MFT, takabanana, ComFreek
#
# If PowerShell exits with an error, check if unsigned scripts are allowed in your system.
# You can allow them by calling PowerShell as an Administrator and typing
# ```
# Set-ExecutionPolicy Unrestricted
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active May 11, 2024 22:17
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.